<?php
	$idNews=$_POST['idNews'];
	$req=mysql_query("SELECT * FROM infos_news WHERE idNews='$idNews'") or die (mysql_error());
	$row=mysql_fetch_array($req);
	$NomNews=$row['NomNews'];
	$JourNews=$row['JourNews'];
	$MoisNews=$row['MoisNews'];
	$AnneeNews=$row['AnneeNews'];
	$NomTable="stat_".$idNews;

	$req2=mysql_query("SELECT * FROM $NomTable ORDER BY VEmail") or die (mysql_error());
	$nbEmailTotal=mysql_num_rows($req2);
	?>
	<div style="text-align:center; padding:5px 0 20px 0; font-size:18px; ">STATISTIQUES NEWSLETTER<br> <?php echo "<strong>".$NomNews."</strong> du ".$JourNews."/".$MoisNews."/".$AnneeNews;?> </div>
	<?php
	if($nbEmailTotal>0){ ?>
	<div class="detail">
	
	<?php if(!isset($_POST['details'])){ ?>
	<form action="" method="post">
	<input name="idNews" type="hidden"  value="<?php echo $idNews ?>">
	<input name="details" type="hidden"  value="">
	<input name="Envoyer" type="image" img src="./images/Detail.jpg" value="Modifier" class="modif">
	</form><?php }
	else{?>
<form action="" method="post">
	<input name="idNews" type="hidden"  value="<?php echo $idNews ?>">
	<input name="Envoyer" type="image" img src="./images/DetailBack.jpg" value="Modifier" class="modif">
	</form>
	<?php } ?>
</div>
<?php } ?>
<?php
	if(isset($_POST['details'])){
?>
<table width="474" border="0" cellspacing="0" cellpadding="0" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; " align="center">
  <tr style="text-align:center; border:1px solid #CCCCCC;  ">
    <td width="36" class="DenoDetails">&nbsp;</td>
    <td width="94" class="DenoDetails"><strong>Email ouverts</strong></td>
    <td width="240" class="DenoDetails" style="text-align:center;"><strong>Support</strong></td>
	<td width="240" class="DenoDetails" style="text-align:center;"><strong>Navigateur</strong></td>
    <td width="71" class="DenoDetails" style="text-align:center;"><strong>Horaire</strong> </td>
    <td width="289" class="DenoDetails" style="text-align:center;"><strong>Date</strong></td>
  </tr>
  <?php
  $i=1;
  while($row2=mysql_fetch_array($req2)){
  $Email=$row2['VEmail'];
  $Nav=$row2['Agent'];
  $NavHelp=$row2['Agent'];
  include('inc/TransAgent.php');
  $Hr=$row2['Hr'];
  $Min=$row2['Min'];
  $Jour=$row2['Jour'];
  $Mois=$row2['Mois'];
  $Annee=$row2['Annee'];
  ?>
  <tr>
    <td style="border-bottom:1px solid #CCCCCC; "><?php echo $i++; ?></td>
    <td style="border-bottom:1px solid #CCCCCC; "><strong><?php echo $Email; ?></strong></td>
    <td style="border-bottom:1px solid #CCCCCC; font-size:9px; text-align:center;"><?php echo $NavTrans; ?></td>
	<td style="border-bottom:1px solid #CCCCCC; font-size:9px; text-align:center;"><?php echo $Support; ?></td>
    <td style="border-bottom:1px solid #CCCCCC; font-size:12px; text-align:center;"><?php echo $Hr." : ".$Min; ?></td>
    <td style="border-bottom:1px solid #CCCCCC; font-size:12px; text-align:center;"><strong><?php echo $Jour."/".$Mois."/".$Annee; ?></strong></td>
  </tr>
  <?php } ?>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
	<td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<br>
<?php } ?>
<div class="Separator"><img src="./images/Separator.jpg"></div>
<?PHP
if($nbEmailTotal>0){ ?>
<?php include('inc/StatInfoEmails.php'); ?>
<br><div class="Separator"><img src="./images/Separator.jpg"></div>
<?php include('inc/StatInfoSupport.php'); ?><br><div class="Separator"><img src="./images/Separator.jpg"></div>
<?php include('inc/StatInfoNavigateur.php'); ?>
<?php
}
else{
echo "<div class='StatError'>Aucune information disponible</div>";
}
?>